package com.kbs.pay.management.util;


import com.kbs.pay.common.response.BaseResponse;
import com.kbs.pay.management.constant.ResponseEnum;

/**
 * @author Lenki
 */
public class ResponseUtils {

    public static BaseResponse success() {
        BaseResponse response = new BaseResponse();
        response.setCode(200);
        response.setMsg("OK");
        return response;
    }

    public static BaseResponse success(Object object) {
        BaseResponse response = success();
        response.setData(object);
        return response;
    }

    public static BaseResponse fail(Integer code, String msg) {
        BaseResponse response = new BaseResponse();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }

    public static BaseResponse fail(ResponseEnum responseEnum) {
        BaseResponse response = new BaseResponse();
        response.setCode(responseEnum.getCode());
        response.setMsg(responseEnum.getMsg());
        return response;
    }

}
